<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const todos = [
        { id: 1, content: '吃饭', done: true },
        { id: 2, content: '睡觉', done: false },
        { id: 3, content: '打豆豆', done: true },
        { id: 4, content: '打球', done: false },
      ]

      // 只要回调函数的return值为true, 则该元素会被保留
      // const res = todos.filter((todo) => todo.done)
      // console.log(res)
      const res = todos.filter((todo) => todo.done === false)
      console.log(res)
    </script>
  </body>
</html>
